#!/usr/bin/perl
use strict;
use Cache::Memcached;

my $memc = new Cache::Memcached ( {
		'servers' => [
		"127.0.0.1:11211",
		],
		'debug' => 0,
		'compress_threshold' => 10_10000,
		});
my $pkey = "20120526";
my $key;
my $value = "date";
my $cnt = 0;

foreach my $pro (1 .. 10) {
	my $pid = fork();
	if ($pid == 0) {
		while (1) {
			$pkey ++;
			$key = $pro . "_" . $pkey; 
			$value = "date_$key";
			print "key:$key,value:$value\n";
			my $was_set = $memc->set($key, $value);
			my $value_get = $memc->get($key);
			print "was_set:$was_set,key:$key,value_get:$value_get\n";
			$cnt ++;
			if ($cnt > 10) {
				exit(0);
			}
#	sleep(1);
		}
	} else {
		print "fork:pid=$pid\n";
	}
}

foreach my $proc (1 .. 1000) {
	wait();
}

